package com.oocl.reservedparkingsystembackend.controller;

import com.oocl.reservedparkingsystembackend.model.dto.ParkingLotRequest;
import com.oocl.reservedparkingsystembackend.model.dto.ParkingLotResponse;
import com.oocl.reservedparkingsystembackend.service.ParkingLotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/parking-lots")
public class ParkingLotController {
    @Autowired
    private ParkingLotService parkingLotService;

    @ResponseStatus(HttpStatus.OK)
    @GetMapping
    public List<ParkingLotResponse> getParkingLot(){
        return parkingLotService.getAllParkingLot();
    }

    @ResponseStatus(HttpStatus.CREATED)
    @PostMapping
    public ParkingLotResponse addParkingLot(@RequestBody ParkingLotRequest parkingLotRequest){
        return parkingLotService.addParkingLot(parkingLotRequest);
    }


}
